{include file='head'/}
<style>
    #ueditorCheckBox .layui-form-checkbox{margin-bottom:10px;}
</style>
<body class="pear-container">
<div class="layui-card">
    <div class="layui-card-body">
        <blockquote class="layui-elem-quote">
            取值方式： get_config(); 例如，取站点名称：get_config('site_name')
        </blockquote>
        <form class="layui-form" action="javascript:;" onsubmit="return dosub(this)">
            <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
                <ul class="layui-tab-title">
                    <li class="layui-this">基本设置</li>
                    <li>安全设置</li>
                    <li>附件设置</li>
                    <li>UeditorPlus图标</li>
                </ul>
                <div class="layui-tab-content" style="margin-top: 10px;">
                    <div class="layui-tab-item layui-show">
                        <table class="layui-table" width="100%">
                            <thead>
                            <tr>
                                <th width="15%">名称</th>
                                <th>变量值</th>
                                <th width="12%">变量名</th>
                            </tr>
                            </thead>
                            <tbody>
                            <tr>
                                <td>站点名称</td>
                                <td>
                                    <input type="text" name="site_name" value="{$data.site_name}" lay-verify="required"
                                           autocomplete="off" class="layui-input" lay-reqtext="站点名称不能为空">
                                </td>
                                <td>site_name</td>
                            </tr>
                            <tr>
                                <td>站点根网址</td>
                                <td>
                                    <input type="text" name="site_url" value="{$data.site_url}" lay-verify="required"
                                           autocomplete="off" class="layui-input" lay-reqtext="站点根网址不能为空">
                                </td>
                                <td>site_url</td>
                            </tr>
                            <tr>
                                <td>网站关键词</td>
                                <td>
                                    <input type="text" name="site_keyword" value="{$data.site_keyword}"
                                           autocomplete="off" class="layui-input">
                                </td>
                                <td>site_keyword</td>
                            </tr>
                            <tr>
                                <td>网站版权信息</td>
                                <td>
                                    <input type="text" name="site_copyright" value="{$data.site_copyright}"
                                           autocomplete="off" class="layui-input">
                                </td>
                                <td>site_copyright</td>
                            </tr>
                            <tr>
                                <td>网站备案号</td>
                                <td>
                                    <input type="text" name="site_beian" value="{$data.site_beian}" autocomplete="off"
                                           class="layui-input">
                                </td>
                                <td>site_beian</td>
                            </tr>
                            <tr>
                                <td>网站描述</td>
                                <td>
                                    <textarea placeholder="统计代码" class="layui-textarea" id="site_description"
                                              name="site_description">{$data.site_description}</textarea>
                                </td>
                                <td>site_description</td>
                            </tr>
                            <tr>
                                <td>统计代码</td>
                                <td>
                                    <textarea placeholder="统计代码" class="layui-textarea" id="site_code" name="site_code">{$data.site_code}</textarea>
                                </td>
                                <td>site_code</td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                    <div class="layui-tab-item">
                        <table class="layui-table">
                            <thead>
                            <tr>
                                <th width="15%">站点名称</th>
                                <th>变量值</th>
                                <th width="12%">变量名</th>
                            </tr>
                            </thead>
                            <tbody>
                            <tr>
                                <td>后台登录验证码</td>
                                <td>
                                    <input lay-filter="captcha_mode" type="radio" name="login_captcha" value="1" title="字母验证码"
                                           {if ($data.login_captcha==1)}checked{/if}>
                                    <input lay-filter="captcha_mode" type="radio" name="login_captcha" value="2" title="顶象验证码"
                                           {if ($data.login_captcha==2)}checked{/if}>
                                    <input lay-filter="captcha_mode" type="radio" name="login_captcha" value="0" title="关闭"
                                           {if($data.login_captcha==0)}checked{/if}>
                                </td>
                                <td>login_captcha</td>
                            </tr>
                            <tr class="captcha_mode captcha_2" {if ($data.login_captcha!='2' )} style="display:none" {/if}>
                            <td>顶象appID</td>
                            <td>
                                <input type="text" name="dingxiang_appid" value="{$data.dingxiang_appid}" autocomplete="off"
                                       class="layui-input">
                                <div class="layui-form-mid layui-word-aux">
                                    <p style="color:#FF5722;">请先去顶象官网后台获取AppID。https://console.dingxiang-inc.com/#/captcha/config</p>
                                </div>
                            </td>
                            <td>dingxiang_appid</td>
                            </tr>
                            <tr class="captcha_mode captcha_2" {if ($data.login_captcha!='2' )} style="display:none" {/if}>
                            <td>顶象appSecret</td>
                            <td>
                                <input type="text" name="dingxiang_appSecret" value="{$data.dingxiang_appSecret}" autocomplete="off"
                                       class="layui-input">
                                <div class="layui-form-mid layui-word-aux">
                                    <p style="color:#FF5722;">请先去顶象官网后台获取appSecret。https://console.dingxiang-inc.com/#/captcha/config</p>
                                </div>
                            </td>
                            <td>dingxiang_appSecret</td>
                            </tr>
                            <tr class="captcha_mode captcha_2" {if ($data.login_captcha!='2' )} style="display:none" {/if}>
                            <td>顶象appSecret</td>
                            <td>
                                <input type="text" name="dingxiang_apiurl" value="{$data.dingxiang_apiurl}" autocomplete="off"
                                       class="layui-input" placeholder="例如：https://xxx.dingxiang-inc.com">
                                <div class="layui-form-mid layui-word-aux">
                                    <p>请先去顶象官网后台获取api应用网址。<b style="color:#FF5722;">【前面要带上https://，结尾不要有斜杠“/”】</b></p>
                                </div>
                            </td>
                            <td>dingxiang_appSecret</td>
                            </tr>
                            <tr>
                                <td>启用后台管理操作日志</td>
                                <td>
                                    <input type="radio" name="admin_log" value="1" title="启用" {if
                                           ($data.admin_log==1)}checked{/if}>
                                    <input type="radio" name="admin_log" value="0" title="禁用" {if
                                           ($data.admin_log==0)}checked{/if}>
                                </td>
                                <td>admin_log</td>
                            </tr>

                            <tr>
                                <td>此ip禁止访问网站</td>
                                <td>
                                    <textarea class="layui-textarea" name="admin_prohibit_ip"
                                              placeholder="匹配IP段用“*”占位，如192.168.*.*，多个IP地址请用英文逗号“,”分割">{$data.admin_prohibit_ip}</textarea>
                                    <div class="layui-form-mid layui-word-aux">匹配IP段用“*”占位多个IP用“,”分割</div>
                                </td>
                                <td>admin_prohibit_ip</td>
                            </tr>

                            <tr>
                                <td>文本编辑器</td>
                                <td>
                                    <div class="layui-input-inline">
                                        <select name="site_editor">
                                            <option value="uEditorPlus" {if ($data.site_editor=='uEditorPlus')}selected{/if}>
                                                uEditorPlus
                                            </option>
                                            <option value="sdEditor" {if ($data.site_editor=='sdEditor')}selected{/if}>
                                                sdEditor
                                            </option>
                                            <option value="iceEditor" {if ($data.site_editor=='iceEditor')}selected{/if}>
                                                iceEditor
                                            </option>
                                        </select>
                                    </div>
                                </td>
                                <td>site_editor</td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                    <div class="layui-tab-item">
                        <table class="layui-table">
                            <thead>
                            <tr>
                                <th width="15%">站点名称</th>
                                <th>变量值</th>
                                <th width="12%">变量名</th>
                            </tr>
                            </thead>
                            <tbody>

                            <tr>
                                <td>允许上传图片类型</td>
                                <td>
                                    <input type="text" name="upload_types_image" value="{$data.upload_types_image}"
                                           autocomplete="off" class="layui-input">
                                </td>
                                <td>upload_types_image</td>
                            </tr>
                            <tr>
                                <td>允许上传附件类型</td>
                                <td>
                                    <input type="text" name="upload_types_file" value="{$data.upload_types_file}"
                                           autocomplete="off" class="layui-input">
                                </td>
                                <td>upload_types_file</td>
                            </tr>
                            <tr>
                                <td>多图上传图片数量限制</td>
                                <td>
                                    <div class="layui-input-inline">
                                        <input type="number" name="pic_more_nums" value="{$data.pic_more_nums}"
                                               autocomplete="off" class="layui-input">
                                    </div>
                                    <span style="margin-left:10px; color:#f00">[0 为不限制]</span>
                                </td>
                                <td>pic_more_nums</td>
                            </tr>
                            <tr>
                                <td>保存方式</td>
                                <td>
                                    <div class="layui-input-inline">
                                        <select name="upload_mode" lay-filter="upload_mode">
                                            </option>
                                            {foreach $upload_modes as $key=>$v}
                                            <option value="{$key}" {if ($data.upload_mode eq $key)}selected{/if}>{$v}</option>
                                            {/foreach}
                                        </select>
                                    </div>
                                    <br><span style="color:#ff00ea">[非“本地保存”，请在配置文件里对密钥等信息进行配置 <span style="font-weight: bold;color:#ff6a00">(config/plugin/yzh52521/filesystem/app.php)</span>，否则上传失败]</span>
                                </td>
                                <td>upload_mode</td>
                            </tr>
                            <tr>
                                <td>是否开启图片水印</td>
                                <td>
                                    <input type="radio" name="watermark_enable" value="1" title="开启" {if
                                           ($data.watermark_enable==1)}checked{/if}>
                                    <input type="radio" name="watermark_enable" value="0" title="关闭" {if
                                           ($data.watermark_enable==0)}checked{/if}>
                                    <span style="margin-left:10px; color:#ff00dd">[水印仅对【本地保存】有效]</span>
                                </td>
                                <td>watermark_enable</td>
                            </tr>
                            <tr>
                                <td>水印图片名称</td>
                                <td>
                                    <div class="layui-input-inline">
                                        <input type="text" name="watermark_name" value="{$data.watermark_name}"
                                               autocomplete="off" class="layui-input">
                                    </div>
                                    [水印存放路径:public/static/water]
                                </td>
                                <td>watermark_name</td>
                            </tr>
                            <tr>
                                <td>水印的位置</td>
                                <td>
                                    <input type="radio" name="watermark_position" value="1" title="顶部居左" {if
                                           ($data.watermark_position==1)}checked{/if}>
                                    <input type="radio" name="watermark_position" value="2" title="顶部居中" {if
                                           ($data.watermark_position==2)}checked{/if}>
                                    <input type="radio" name="watermark_position" value="3" title="顶部居右" {if
                                           ($data.watermark_position==3)}checked{/if}>
                                    <input type="radio" name="watermark_position" value="4" title="中部居左" {if
                                           ($data.watermark_position==4)}checked{/if}>
                                    <input type="radio" name="watermark_position" value="5" title="中部居中" {if
                                           ($data.watermark_position==5)}checked{/if}>
                                    <input type="radio" name="watermark_position" value="6" title="中部居右" {if
                                           ($data.watermark_position==6)}checked{/if}>
                                    <input type="radio" name="watermark_position" value="7" title="顶部居左" {if
                                           ($data.watermark_position==7)}checked{/if}>
                                    <input type="radio" name="watermark_position" value="8" title="底部居中" {if
                                           ($data.watermark_position==8)}checked{/if}>
                                    <input type="radio" name="watermark_position" value="9" title="底部居右" {if
                                           ($data.watermark_position==9)}checked{/if}>
                                </td>
                                <td>watermark_position</td>
                            </tr>
                            <tr>
                                <td>水印透明度</td>
                                <td>
                                    <div class="layui-input-inline" style="width:65%;margin:18px 0;">
                                        <div id="slideTest2" class="demo-slider"></div>
                                        <input type="hidden" name="watermark_touming" id="watermark_touming">
                                    </div>
                                    [水印透明度设置]
                                </td>
                                <td>watermark_touming</td>
                            </tr>

                            </tbody>
                        </table>
                    </div>
                    <div class="layui-tab-item">
                        <table class="layui-table">
                            <thead>
                            <tr>
                                <th width="15%">站点名称</th>
                                <th>变量值</th>
                                <th width="12%">变量名</th>
                            </tr>
                            </thead>
                            <tbody>
                            <tr>
                                <td>&emsp;请勾选要启用的图标<br>【全选或不选显示全部】</td>
                                <td id="ueditorCheckBox">
                                    {foreach $ueditor_icon as $key=>$v}
                                    <input type="checkbox" name="ueditor_icon[]" value="{$key}" title="{$v}" <?php if(in_array($key,$data['ueditor_icon'])) echo "checked"; ?>>
                                    {/foreach}
                                </td>
                                <td>ueditor_icon</td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>

            <div class="layui-form-item ">
                <label class="layui-form-label"></label>
                <div class="layui-input-inline" style="width: 80%">
                    <input class="layui-btn" type="submit" value="立即保存" lay-submit="">
                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </div>
            </div>

        </form>

    </div>

</div>
{include file='footer'/}
<script>
  layui.use(['form', 'element', 'slider', 'jquery'], function () {
    var $ = layui.jquery
      , slider = layui.slider
      , form = layui.form
      , element = layui.element;
    slider.render({
      elem: '#slideTest2'
      , value: '{$data.watermark_touming}'
      , theme: '#FF5722' //主题色
      , input: true //输入框
    });
    form.on('radio(captcha_mode)', function (data) {
      $('.captcha_mode').hide();
      $('.captcha_' + data.value).show();
    });

    //保存
    window.dosub = function (obj) {
      var watermark_touming = $(".layui-slider-tips").text() || "{$data.watermark_touming}";
      $("#watermark_touming").val(watermark_touming);
      $.ajax({
        type: 'POST',
        url: "{:__url('system/config/save')}",
        data: $(obj).serialize(),
        dataType: "json",
        success: function (res) {
          if (res.code === 200) {
            layer.msg(res.msg, {icon: 1, time: 2000}, function () {
              window.location.reload();
            })
          } else {
            layer.msg(res.msg, {icon: 2, time: 2000})
          }
        }
      });
    }

  });


</script>
</body>
</html>
